package com.qmyx.supply.admin.controller;

import com.ytjj.qmyx.supplychain.common.api.CommonResult;
import com.ytjj.qmyx.supplychain.common.model.request.InterceptRequest;
import com.ytjj.qmyx.supplychain.service.OrdersInterceptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/intercept")
public class OrderInterceptController {
    @Autowired
    private OrdersInterceptService ordersInterceptService;

    /**
     * 拦截列表
     */
    @PostMapping("/interceptOrderList")
    public CommonResult interceptOrderList(@RequestBody InterceptRequest interceptRequest) {
        return CommonResult.success(ordersInterceptService.getInterceptOrderList(interceptRequest));
    }

    /**
     * 修改状态
     */
    @GetMapping("/updateStatus")
    //@OperLog(operModule = "拦截管理", operDesc = "修改拦截状态", operType = SysLogConstants.OPERATION_UPDATE)
    public CommonResult updateStatus(@RequestParam Integer id, @RequestParam Integer status) {
        int count = ordersInterceptService.updateStatus(id, status);
        if (count > 0) {
            return CommonResult.success(count);
        } else {
            return CommonResult.failed();
        }
    }
}
